from PyQt6.QtWidgets import (QMainWindow, QApplication, QHBoxLayout,QVBoxLayout,QLabel,QWidget, QLineEdit, QCheckBox, QComboBox, 
                            QSlider, QSpinBox, QHBoxLayout)

class ControlWindow(QMainWindow):
    def __init__(self):
        super().__init__()
        
        self.setWindowTitle("控件演示")
        self.setGeometry(100, 100, 400, 300)
        
        # 创建各种控件
        self.line_edit = QLineEdit()
        self.checkbox = QCheckBox("同意条款")
        self.combobox = QComboBox()
        self.combobox.addItems(["选项1", "选项2", "选项3"])
        self.slider = QSlider()
        self.spinbox = QSpinBox()
        
        # 创建布局
        main_layout = QVBoxLayout()
        
        # 第一行水平布局
        row1 = QHBoxLayout()
        row1.addWidget(QLabel("文本输入:"))
        row1.addWidget(self.line_edit)
        
        # 添加所有控件到主布局
        main_layout.addLayout(row1)
        main_layout.addWidget(self.checkbox)
        main_layout.addWidget(QLabel("下拉选择:"))
        main_layout.addWidget(self.combobox)
        main_layout.addWidget(QLabel("滑块:"))
        main_layout.addWidget(self.slider)
        main_layout.addWidget(QLabel("数字输入:"))
        main_layout.addWidget(self.spinbox)
        
        # 设置中心部件
        container = QWidget()
        container.setLayout(main_layout)
        self.setCentralWidget(container)

# 使用示例
app = QApplication([])
window = ControlWindow()
window.show()
app.exec()